package system;

import book.Book;
import book.BookList;

import java.util.Scanner;
import java.util.StringTokenizer;

public class AddOperation implements IOperation{


    @Override
    public void work(BookList bookList) {
        System.out.println("添加图书");
        if(bookList.getUseSize() == BookList.MAXSIZE_BOOK){
            System.out.println("书架已经满了");
        }else{
            bookList.setBook(bookList.getUseSize(),addBook());
        }

    }
public Book addBook(){
    Scanner scan = new Scanner(System.in) ;
    System.out.println("请输入书名");
    String name = scan.nextLine() ;
    System.out.println("请输入作者");
//    scan.nextLine();
    String writer = scan .nextLine();
    System.out.println("请输入价格");
    int money = scan.nextInt() ;
    return new Book(name,writer,money) ;

}



}
